<?php 
session_start();
require_once("include/authen.php");
require_once("include/ui.php");
if ($_SESSION["permission"][$return_product_report]["View"]=="0"){
	echo "<script>alert('".$no_permit."');</script>";
	echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	exit();
}
echo headerPage("Return Product Report");
?>
<script>
$(function() {
	$('#dtReturnFrom,#dtReturnTo').datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
				changeMonth: true,
		changeYear: true,
		yearRange:'c-10:c+1',			
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
		
	$("#btnPrint").button({
				icons:{
				 primary: "ui-icon-print"
				}
	});	
	$.get('a_user.php',{"c":"b"},function(data){
		var obj=eval('('+data+')');
		if (obj !=null){
		$.each(obj, function(index, text) {
			$("#cboBranch").append(
					$('<option></option>').val(text).html(index)
			 );
		});
		
			if ( $("#isHO").val()=='0' ) 
				$("#cboBranch").val($("#bid").val()).attr('disabled','disabled');
			 
		}
	});
		if  ( $("#isHO").val()=='1' ) {
			$("#cboBranch").append($('<option></option>').val(0).html('All'));
	}
	
		$("#btnPrint").click(function(){
		if ($("#dtReturnFrom").val().length < 1) {
			alert("Please input ReturnDate");
			return false;
		}else if ($("#dtReturnTo").val().length < 1) {
			alert("Please input ReturnDate");
			return false;
		}else  {
			$("#dFrom").val( $("#dtReturnFrom").val() );
			$("#dTo").val( $("#dtReturnTo").val() );
			$("#branch").val( $("#cboBranch").val() );
			$("#type").val( $("input[name:returntype]:checked").val() );
			//alert($("#dFrom").val());
				return true;
		}
		

	});
});
</script>

<FORM name="Act" id="Act" action="return_product.php" method="post" target="_blank"> 
<INPUT type=hidden value="" id="dFrom" name="dFrom"> 
<INPUT type=hidden value="" id="dTo" name="dTo"> 
<INPUT type=hidden value="" id="branch" name="branch"> 
<INPUT type=hidden value="" id="type" name="type"> 
<INPUT type=hidden value="<?php echo $_SESSION['bid'];?>" id="bid" name="bid"> 
<INPUT type=hidden value="<?php echo $_SESSION['branchtype'];?>" id="isHO" name="isHO"> 
<table width="1024" height="400px" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" style='border-left:2px solid #facb0c;'>&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr><td></td>
                         </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/doc.png);">
						Return Product Report
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
				<fieldset  class="ui-widget ui-widget-content">
				<legend>Return Product Report</legend>	
                    <table width="100%"  id="infotable" style="line-height:36px">
                        <tr>
                            <td width="35%" class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name">&nbsp;&nbsp;Return Date From : </label>
								<input type='text' id='dtReturnFrom' style='font-size:12px;padding:3px;border:1px solid #ccc' name='dtSaleFrom' stype value=""/>
							</td>
                            <td width="65%" class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name">Return Date To : </label>
								<input type='text' id='dtReturnTo' name='dtSaleTo' style='font-size:12px;padding:3px;border:1px solid #ccc' value=""/>
							</td>							
						</tr>
						<tr>
							<td width="35%"   class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name" style='padding-right:55px'>&nbsp;&nbsp;Branch : &nbsp;&nbsp;</label><select id='cboBranch' style='font-size:12px;padding:2px;'></select>
							</td>
							<td class="fontSearch" style="padding-left:20;font-weight:normal;">
								<label for="name">Return Type : </label>&nbsp;&nbsp;&nbsp;&nbsp;
								<input type='radio' name='returntype' id="Type_0" value="0" checked/> All
								&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='returntype' id="Type_1" value="1"/> Normal
								&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='returntype' id="Type_2" value="2"/> Damage
							</td>
						</tr>
						<tr>
							<td width="100%" colspan="2" class="fontSearch" align="right">
								<button id="btnPrint" style="font-size:12px">Print</button>
							</td>
						</tr>
                    </table>
				</fieldset>
				<p></P>
                 <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" style='border-right:2px solid #facb0c;'>&nbsp;</td>
  </tr>
</table>
 </FORM>
<?php echo footer();?>